package com.lifp.validation.annotation;

import com.lifp.validation.PasswordConstraintValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * @Description TODO
 * @Author lfp
 * @Date 2022/4/24 16:11
 * @Version 1.0
 */
@Documented
@Retention(RUNTIME)
@Constraint(validatedBy = PasswordConstraintValidator.class)
@Target({TYPE, FIELD, ANNOTATION_TYPE})
public @interface ValidPassword {
    // 默认返回的 error message
    String message() default "密码无效";

    Class<?>[] groups() default { };

    Class<? extends Payload>[] payload() default { };
}
